<?php
header('Content-Type: text/html; charset=UTF-8');

/*常用信息开始*/
define('DB_NAME', 'chetan_h1');
define('DB_USER', 'chetan_h1');
define('DB_PASSWORD', 'zyk1750');
define('DB_HOST', '103.251.89.9');

/*定义微博*/
define( "WB_AKEY" , '3648180875' );
define( "WB_SKEY" , 'c3c1befe6bc436f70eb4a551173f75da' );
define( "WB_CALLBACK_URL" , 'http://1.zidong1750.duapp.com/weibo.php' );

/*定义人人*/
define ( 'DEBUG_MODE', false );
define ( "RENREN_APP_KEY", '3db12a401593449fb477b307c11d250c' );
define ( "RENREN_APP_SECRET", '224cc3a6b6984d5cb7807320c9172196' );
define ( "RENREN_CALLBACK_URL", "http://".get_domain_all()."/renren2.0/callback.php" );

define ( 'ZYK_URL', "http://".get_domain_all()."/" );
define ( 'ZYK_RENREN_TOKEN', "264215|6.ba4ebeeaf74acdca866597f9daac7bad.2592000.1394532000-494111412" );

$nameArr = array('尤西门','范殴','周晁勾','章台公','陶慕连','严太叔','严别','鲁丘','钱司');
$contentArr = array('你好，我是可可推，天天看状态无聊了吗，来http://www.keketui.com吧，和我一起看点不一样的东西~','哈喽~我是可可推，看别人的状态厌倦了吗？来http://www.keketui.com清静清净吧，每天给您推荐有用的东东~~~，嘿嘿','在五彩缤纷的社交网络中感觉到无趣吗？我是可可推，到http://www.keketui.com静清吧，天天给你推荐有用的东西，嘿嘿','哈喽哈喽~~我是可可推，天天泡在人人上感觉空洞了吗，来http://www.keketui.com,看点不一样的东西，，，吧~');
//$contentArr = array('你好可可推');

/*常用信息完*/
$zyk_url = ZYK_URL;
if (DEBUG_MODE) {
    error_reporting ( E_ALL );
    ini_set ( 'display_errors', true );
}
/* 例如：http://mlll123.22c.pw/abc/ */
function get_domain(){
    $host=$_SERVER['HTTP_HOST'];
    $host=strtolower($host);
    if(strpos($host,'/')!==false){
        $parse = @parse_url($host);
        $host = $parse['host'];
    }
    $topleveldomaindb=array('com','edu','gov','int','mil','net','org','biz','info','pro','name','museum','coop','aero','xxx','idv','mobi','cc','me');
    $str='';
    foreach($topleveldomaindb as $v){
        $str.=($str ? '|' : '').$v;
    }
    $matchstr="[^\.]+\.(?:(".$str.")|\w{2}|((".$str.")\.\w{2}))$";
    if(preg_match("/".$matchstr."/ies",$host,$matchs)){
        $domain=$matchs['0'];
    }else{
        $domain=$host;
    }
    if($domain == 'duapp.com'){
        $host=$_SERVER['HTTP_HOST'];
        $domain=strtolower($host);
    }
    return $domain;
}
function get_domain_all(){
    $host=$_SERVER['HTTP_HOST'];
    $host=strtolower($host);
    return $host;
}
function dump($vars, $label = '', $return = false) {
    if (ini_get('html_errors')) {
        $content = "<pre>\n";
        if ($label != '') {
            $content .= "<strong>{$label} :</strong>\n";
        }
        $content .= htmlspecialchars(print_r($vars, true));
        $content .= "\n</pre>\n";
    } else {
        $content = $label . " :\n" . print_r($vars, true);
    }
    if ($return) { return $content; }
    echo $content;
    return null;
}
